package com.hk.springsecurity02.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author by 何坤
 * @Classname MyCorsConfig
 * @Description TODO
 * @Date 2019/12/23 15:38
 */
@Configuration
public class MyCorsConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedMethods("GET","POST","DELETE", "PUT")
                .allowedOrigins("*")
                .allowCredentials(true)
                .allowedHeaders("*")
                .maxAge(3600);
    }
}
